//package com.lt.test.consumer.controller;
//
//import com.alibaba.dubbo.config.annotation.Reference;
//import com.lt.test.api.*;
//import com.lt.test.common.constant.HttpRequestConstant;
//import com.lt.test.common.exception.CustomException;
//import com.lt.test.common.thread.BindCarThread;
//import com.lt.test.common.util.CustomUtil;
//import com.lt.test.common.util.ExcelUtil;
//import com.lt.test.common.util.StringUtils;
//import com.lt.test.entity.DTO.*;
//import com.lt.test.entity.QueryModel.MapQueryModel;
//import net.sf.json.JSONArray;
//import net.sf.json.JsonConfig;
//import org.apache.poi.hssf.usermodel.HSSFWorkbook;
//import org.apache.shiro.SecurityUtils;
//import org.apache.shiro.authz.annotation.RequiresPermissions;
//import org.apache.shiro.subject.Subject;
//import org.aspectj.util.FileUtil;
//import org.slf4j.Logger;
//import org.slf4j.LoggerFactory;
//import org.springframework.stereotype.Controller;
//import org.springframework.web.bind.annotation.RequestMapping;
//import org.springframework.web.bind.annotation.ResponseBody;
//import org.springframework.web.multipart.MultipartFile;
//
//import javax.annotation.Resource;
//import javax.servlet.http.HttpServletRequest;
//import javax.servlet.http.HttpServletResponse;
//import java.io.File;
//import java.io.FileInputStream;
//import java.io.OutputStream;
//import java.text.SimpleDateFormat;
//import java.util.*;
//
///**
// * 数据统计相关页面控制器
// * 数据展示相关的接口
// * Created by zhengchuan on 2017/3/22.
// */
//@Controller
//@RequestMapping("/page")
//public class StaticPageController {
//    private static final Logger logger = LoggerFactory.getLogger(StaticPageController.class);
//    /**
//     * 烟草订烟服务接口
//     */
//    @Reference(version = "1.0.0")
//    private SPLOrderService sPLOrderService;
//    /**
//     * 店铺管理服务接口
//     */
//    @Reference(version = "1.0.0")
//    private ShopService shopService;
//    /**
//     * 客户管理服务接口
//     */
//    @Reference(version = "1.0.0")
//    private CgtCustService cgtCustService;
//    /**
//     * 运维平台用户服务接口
//     */
//    @Reference(version = "1.0.0")
//    private UserService userService;
//    /**
//     * 缓存服务接口
//     */
//    @Reference(version = "1.0.0")
//    private RedisService redisService;
//
//    /**
//     * 获取烟草订单统计数据：
//     *      首次获取时拉取最新的十条
//     *      lastOrderTime不为空时，获取lastOrderTime之后的新订单
//     *
//     * @param lastOrderTime 获取在这个时间之后创建的订单
//     * @return 请求响应的内容
//     */
//    @RequestMapping("/getOrder")
//    public
//    @ResponseBody
//    ResponseDTO getOrder(String lastOrderTime) {
//        //跨域处理，如果需要浏览器跨域名访问，放开注释
//        /*response.setHeader("Access-Control-Allow-Origin", "*");
//        response.setHeader("Access-Control-Allow-Methods", "POST, GET, OPTIONS, DELETE");
//        response.setHeader("Access-Control-Max-Age", "3600");
//        response.setHeader("Access-Control-Allow-Headers", "x-requested-with");*/
//
//        ResponseDTO responseDTO = new ResponseDTO();
//        Map<String, Object> result = new HashMap<>(4);
//
//        Subject subject = SecurityUtils.getSubject();
//        //身份
//        ActiveUser activeUser = (ActiveUser) subject.getPrincipal();
//
//        List<SPLOrderDTO> SPLOrderList = null;
//        Map<String, Object> SPLOrderDayData = null;//按天查询的订单统计数据
//        Map<String, Object> SPLOrderMonthData = null;//按月查询的订单统计数据
//        Map<String, Object> SPLOrderYearData = null;//按周查询的订单统计数据
//        Map<String, Object> successSPLOrderDayData = null;//按天查询的成功订单统计数据
//        Map<String, Object> successSPLOrderMonthData = null;//按月查询的成功订单统计数据
//        Map<String, Object> successSPLOrderYearData = null;//按周查询的成功订单统计数据
//        try {
//            SPLOrderList = sPLOrderService.findSPLOrderByLsatCreateTime(lastOrderTime, activeUser);
//            if (SPLOrderList != null && !SPLOrderList.isEmpty() && false) { //统计数据已独立获取，此判断永远不会进来
//                SPLOrderDayData = sPLOrderService.findSPLOrderDayData(activeUser, null);
//                SPLOrderMonthData = sPLOrderService.findSPLOrderMonthData(activeUser, null);
//                SPLOrderYearData = sPLOrderService.findSPLOrderYearData(activeUser, null);
//
//                successSPLOrderDayData = sPLOrderService.findSPLOrderDayData(activeUser, "success");
//                successSPLOrderMonthData = sPLOrderService.findSPLOrderMonthData(activeUser, "success");
//                successSPLOrderYearData = sPLOrderService.findSPLOrderYearData(activeUser, "success");
//            }
//            responseDTO.setSuccess(true);
//            responseDTO.setMessage("获取成功");
//            responseDTO.setCode(HttpRequestConstant.REQUEST_SUCCESS_CODE);
//        } catch (CustomException e) {
//            e.printStackTrace();
//            responseDTO.setMessage(e.getMessage());
//        } catch (Exception ex) {
//            ex.printStackTrace();
//            responseDTO.setMessage("未知错误");
//        }
//        result.put("SPLOrderList", SPLOrderList);
//        result.put("SPLOrderDayData", SPLOrderDayData);
//        result.put("SPLOrderMonthData", SPLOrderMonthData);
//        result.put("SPLOrderYearData", SPLOrderYearData);
//
//        result.put("successSPLOrderDayData", successSPLOrderDayData);
//        result.put("successSPLOrderMonthData", successSPLOrderMonthData);
//        result.put("successSPLOrderYearData", successSPLOrderYearData);
//
//        responseDTO.setData(result);
//        return responseDTO;
//    }
//
//
//    /**
//     * 订单统计数据 -- 单独的图形页面
//     * @param params 相关查询条件
//     * @return 订单统计数据
//     * @throws Exception 异常信息，会被全局异常处理捕获
//     */
//    @RequestMapping("/getSplOrderStatistics")
//    public
//    @ResponseBody
//    ResponseDTO getSplOrderStatistics(MapQueryModel params) throws Exception {
//
//        params.getStringMap().put("fiveChannelCode", CustomUtil.getChannelCodePreFive(params.getStringMap().get("cityName")));
//
//        ResponseDTO responseDTO = new ResponseDTO();
//        Map<String, Object> data = new HashMap<>(4,1.0F);
//
//        managerStringMap(params.getStringMap());
//
//        Map<String, List<String>> SPLOrderDayData;//按天查询的订单统计数据
//        Map<String, List<String>> SPLOrderWeekData;//按周查询的订单统计数据
//        Map<String, List<String>> SPLOrderMonthData;//按月查询的订单统计数据
//
//        SPLOrderDayData = sPLOrderService.findSPLOrderStatisticsDayData(params.getStringMap());
//        SPLOrderWeekData = sPLOrderService.findSPLOrderStatisticsWeekData(params.getStringMap());
//        SPLOrderMonthData = sPLOrderService.findSPLOrderStatisticsMonthData(params.getStringMap());
//
//        responseDTO.setSuccess(true);
//        responseDTO.setMessage("获取成功");
//        responseDTO.setCode(HttpRequestConstant.REQUEST_SUCCESS_CODE);
//
//        data.put("main1Data", SPLOrderDayData);
//        data.put("main2Data", SPLOrderWeekData);
//        data.put("main3Data", SPLOrderMonthData);
//
//        responseDTO.setData(data);
//        return responseDTO;
//    }
//
//
//    /**
//     * 跳转到订单统计页面
//     *      通过转发，实现拦截和模版处理
//     *
//     * @param request
//     * @param response
//     * @return
//     */
//    @RequestMapping("/orderDataStatistics")
//    public String orderDataStatistics(HttpServletRequest request, HttpServletResponse response) {
//
//        return "content/statistics/orderDataStatistics";
//    }
//
//    /**
//     * 跳转到烟草订单统计页面 -- 统计图
//     *
//     * @param request
//     * @param response
//     * @return
//     */
//    @RequestMapping("/splOrderStatisticsView")
//    public String splOrderStatisticsView(HttpServletRequest request, HttpServletResponse response) {
//        //将列表页面带入到统计页面
//        request.setAttribute("queryParams",request.getParameter("queryParams"));
//        return "content/statistics/splOrderStatisticsView";
//    }
//
//    /**
//     * 大屏显示
//     *
//     * @param request
//     * @param response
//     * @return
//     */
//    @RequestMapping("/bigScreen")
//    public String bigScreen(HttpServletRequest request, HttpServletResponse response) {
//        return "content/statistics/bigscreen";
//    }
//
//
//    /**
//     * 扫码出货统计
//     *
//     * @param lastOrderTime
//     * @param request
//     * @param response
//     * @return
//     */
//    @RequestMapping("/getShipmentOrder")
//    public
//    @ResponseBody
//    ResponseDTO getShipmentOrder(String lastOrderTime, String shopName, HttpServletRequest request, HttpServletResponse response) throws CustomException {
//
//        ResponseDTO responseDTO = new ResponseDTO();
//        Map<String, Object> result = new HashMap<>(4);
//        Subject subject = SecurityUtils.getSubject();
//        //用户身份信息
//        ActiveUser activeUser = (ActiveUser) subject.getPrincipal();
//
//        //查询条件
//        Map<String, String> params = new HashMap<>();
//
//        params.put("empName", activeUser.getEmpName()); //用户是否是客户经理
//        params.put("realChannelName", activeUser.getRealChannelName()); //用户是否是渠道经理
//
//        //通过区县名称获取对于渠道号
//        String allChannleIds = sPLOrderService.getAllChannelIdByQuXianName(activeUser.getQuXianName());
//        params.put("allChannleIds", allChannleIds);
//        params.put("channelName", activeUser.getChannelName()); //实际上是市局名称
//        params.put("lastOrderTime", lastOrderTime); //最后更新时间
//
//        List<Map<String, Object>> ShipmentOrderList = null;
//        /*Map<String, Object> ShipmentOrderDayData = null;//按天查询的订单统计数据
//        Map<String, Object> ShipmentOrderMonthData = null;//按天查询的订单统计数据
//        Map<String, Object> ShipmentOrderYearData = null;//按天查询的订单统计数据*/
//        try {
//            ShipmentOrderList = shopService.findShipmentOrderByLsatCreateTime(params);
//            /*if (ShipmentOrderList != null && !ShipmentOrderList.isEmpty()) {
//                params.put("shopName", shopName);
//                ShipmentOrderDayData = shopService.findShipmentOrderDayData(params);
//                ShipmentOrderMonthData = shopService.findShipmentOrderMonthData(params);
//                ShipmentOrderYearData = shopService.findShipmentOrderYearData(params);
//            }*/
//            responseDTO.setSuccess(true);
//            responseDTO.setMessage("获取成功");
//            responseDTO.setCode(HttpRequestConstant.REQUEST_SUCCESS_CODE);
//        } catch (CustomException e) {
//            e.printStackTrace();
//            responseDTO.setMessage(e.getMessage());
//        } catch (Exception ex) {
//            ex.printStackTrace();
//            responseDTO.setMessage("未知错误");
//        }
//        result.put("ShipmentOrderList", ShipmentOrderList);
//        /*result.put("ShipmentOrderDayData", ShipmentOrderDayData);
//        result.put("ShipmentOrderMonthData", ShipmentOrderMonthData);
//        result.put("ShipmentOrderYearData", ShipmentOrderYearData);*/
//        responseDTO.setData(result);
//        return responseDTO;
//    }
//
//    /**
//     * 跳转到扫码出货统计页面
//     *
//     * @param request
//     * @param response
//     * @return
//     */
//    @RequestMapping("/shipmentOrderDataStatistics")
//    public String shipmentorderDataStatistics(HttpServletRequest request, HttpServletResponse response) {
//
//        return "content/statistics/shipmentOrderDataStatistics";
//    }
//
//    /**
//     * 跳转到扫码出货统计页面
//     *
//     * @param request
//     * @param response
//     * @return
//     */
//    @RequestMapping("/scratchStatisticsView")
//    public String scratchStatisticsView(HttpServletRequest request, HttpServletResponse response) {
//
//        return "content/statistics/scratchStatisticsView";
//    }
//
//
//    /**
//     * 刮刮奖中奖统计（物料统计）
//     *
//     * @param lastOrderTime
//     * @return
//     */
//    @RequestMapping("/getScratchoff")
//    public
//    @ResponseBody
//    ResponseDTO getScratchoff(String lastOrderTime) throws CustomException {
//        ResponseDTO responseDTO = new ResponseDTO();
//        Map<String, Object> result = new HashMap<>(4);
//
//        List<Map<String, Object>> ShipmentOrderList = null;
//
//        Subject subject = SecurityUtils.getSubject();
//        ActiveUser activeUser = (ActiveUser) subject.getPrincipal();
//
//        Map<String, String> params = new HashMap<>();
//        managerStringMap(params);
//        params.put("lastOrderTime", lastOrderTime);
//
//        try {
//            ShipmentOrderList = shopService.findScratchoffByLsatCreateTime(params);
//
//            responseDTO.setSuccess(true);
//            responseDTO.setMessage("获取成功");
//            responseDTO.setCode(HttpRequestConstant.REQUEST_SUCCESS_CODE);
//        } catch (CustomException e) {
//            e.printStackTrace();
//            responseDTO.setMessage(e.getMessage());
//        } catch (Exception ex) {
//            ex.printStackTrace();
//            responseDTO.setMessage("未知错误");
//        }
//        result.put("ShipmentOrderList", ShipmentOrderList);
//
//        //统计数据已独立出来获取
//        /*result.put("ShipmentOrderDayData", ShipmentOrderDayData);
//        result.put("ShipmentOrderMonthData", ShipmentOrderMonthData);
//        result.put("ShipmentOrderYearData", ShipmentOrderYearData);
//        result.put("residueScratchoff", residueScratchoff);*/
//        responseDTO.setData(result);
//        return responseDTO;
//    }
//
//    /**
//     * 物料投放统计数据 -- 单独的图形页面
//     *
//     * @return
//     */
//    @RequestMapping("/getScratchStatistics")
//    public
//    @ResponseBody
//    ResponseDTO getScratchStatistics(MapQueryModel params) throws Exception {
//
//        ResponseDTO responseDTO = new ResponseDTO();
//        Map<String, Object> data = new HashMap<>(4,1.0F);
//
//        managerStringMap(params.getStringMap());
//
//        Map<String, Object> scratchDayData;//按天查询的数据
//        Map<String, Object> scratchWeekData;//按周查询的数据
//        Map<String, Object> scratchMonthData;//按月查询的数据
//        Map<String, Object> scratchResidue;//剩余奖品统计数据
//
//        scratchDayData = shopService.findScratchoffDayData(params.getStringMap());
//        scratchWeekData = shopService.findScratchoffWeekData(params.getStringMap());
//        scratchMonthData = shopService.findScratchoffMonthData(params.getStringMap());
//        scratchResidue = shopService.findResidueScratchoff(params.getStringMap());
//
//        responseDTO.setSuccess(true);
//        responseDTO.setMessage("获取成功");
//        responseDTO.setCode(HttpRequestConstant.REQUEST_SUCCESS_CODE);
//
//        data.put("main1Data", scratchDayData);
//        data.put("main2Data", scratchWeekData);
//        data.put("main3Data", scratchMonthData);
//        data.put("main4Data", scratchResidue);
//
//        responseDTO.setData(data);
//        return responseDTO;
//    }
//
//    /**
//     * 跳转到刮刮奖中奖（物料统计）统计页面
//     *
//     * @param request
//     * @param response
//     * @return
//     */
//    @RequiresPermissions("SCRATCHOFF:STATISTICS")
//    @RequestMapping("/scratchoff")
//    public String scratchoff(HttpServletRequest request, HttpServletResponse response) {
//
//        return "content/statistics/scratchoff";
//    }
//
//
//    /**
//     * 根据时间查询刮刮奖中奖统计
//     *
//     * @return
//     */
//    @RequiresPermissions("SCRATCHOFF:STATISTICS")
//    @RequestMapping("/getScratchoffByTime")
//    public
//    @ResponseBody
//    ResponseDTO getScratchoffByTime(MapQueryModel params) throws Exception {
//        managerStringMap(params.getStringMap());
//        Subject subject = SecurityUtils.getSubject();
//        //身份
//        ActiveUser activeUser = (ActiveUser) subject.getPrincipal();
//        params.getStringMap().put("userId", activeUser.getUserId());
//
//        List<Map<String, Object>> ShipmentOrderList = shopService.getScratchoffByTime(params.getStringMap());
//
//        ResponseDTO responseDTO = new ResponseDTO();
//        responseDTO.setSuccess(true);
//        responseDTO.setData(ShipmentOrderList);
//        return responseDTO;
//    }
//
//
//    /**
//     * 根据时间查询烟草订单统计
//     *
//     * @param request
//     * @param response
//     * @return
//     */
//    @RequestMapping("/getOrderByTime")
//    public
//    @ResponseBody
//    ResponseDTO getOrderByTime(HttpServletRequest request, HttpServletResponse response) throws Exception {
//        Subject subject = SecurityUtils.getSubject();
//        //身份信息
//        ActiveUser activeUser = (ActiveUser) subject.getPrincipal();
//        String channelName = activeUser.getChannelName();
//
//        //TODO 参数转处理，可以完善一下，优化性能
//        String beginTime = request.getParameter("beginTime");
//        String endTime = request.getParameter("endTime");
//        String custCode = request.getParameter("custName");
//        String empName = request.getParameter("empName");
//        String orderBeginDate = request.getParameter("orderBeginDate");
//        String orderEndDate = request.getParameter("orderEndDate");
//        String channelNamePage = request.getParameter("channelName");
//        String quXianName = request.getParameter("quXianName");
//        String payStatus = request.getParameter("payStatus");
//        String orderId = request.getParameter("orderId");
//        String orderLevel = request.getParameter("orderLevel");
//
//        List<SPLOrderDTO> SPLOrderList = null;
//
//        Map<String, Object> params = new HashMap<>(11);
//        if (quXianName != null && !quXianName.equals("")) {
//            String channelId = sPLOrderService.getIdByChannleName(quXianName);
//            params.put("parentChannelId", channelId == null ? "-99999" : channelId);
//        }
//        params.put("beginTime", beginTime);
//        params.put("endTime", endTime);
//        params.put("userId", activeUser.getUserId());
//        params.put("channelName", channelName);
//        params.put("custCode", custCode);
//        params.put("empName", (activeUser.getEmpName() != null && !activeUser.getEmpName().equals("")) ? activeUser.getEmpName() : empName);
//        params.put("orderBeginDate", orderBeginDate);
//        params.put("orderEndDate", orderEndDate);
//        params.put("channelNamePage", (activeUser.getRealChannelName() != null && !activeUser.getRealChannelName().equals("")) ? activeUser.getRealChannelName() : channelNamePage);
//        params.put("payStatus", payStatus);
//        params.put("orderId", orderId);
//        params.put("orderLevel", orderLevel);
//        params.put("quXianName", activeUser.getQuXianName());
//
//        SPLOrderList = sPLOrderService.getOrderByTime(params);
//
//        ResponseDTO responseDTO = new ResponseDTO();
//        responseDTO.setSuccess(true);
//        responseDTO.setData(SPLOrderList);
//        return responseDTO;
//    }
//
//
//    /**
//     * 根据时间查询出货统计
//     *
//     * @return
//     */
//    @RequestMapping("/getShipmentOrderByTime")
//    public
//    @ResponseBody
//    ResponseDTO getShipmentOrderByTime(MapQueryModel params) throws Exception {
//
//        Subject subject = SecurityUtils.getSubject();
//        ActiveUser activeUser = (ActiveUser) subject.getPrincipal();
//        params.getStringMap().put("channelCode", activeUser.getChannelName());
//
//        String quXianName = params.getStringMap().get("quXianName");
//
//        if (StringUtils.isNot_NullOrTrimEmpty(activeUser.getEmpName())){
//            params.getStringMap().put("empName", activeUser.getEmpName());
//        }
//
//        if (activeUser.getQuXianName() != null && !"".equals(activeUser.getQuXianName())) {
//            quXianName = activeUser.getQuXianName();
//        }
//
//        if (quXianName != null && !quXianName.equals("")) {
//            String channelId = sPLOrderService.getIdByChannleName(quXianName);
//            params.getStringMap().put("parentChannelId", channelId == null ? "-99999" : channelId); //保证错误情况查不到数据
//        }
//
//        if (activeUser.getRealChannelName() != null && !"".equals(activeUser.getRealChannelName())) {
//            params.getStringMap().put("channelName", activeUser.getRealChannelName());
//        }
//
//        List<Map<String, Object>> ShipmentOrderList = new ArrayList<>();
//
//        addShipmentOrderList(ShipmentOrderList, params.getStringMap());
//
//        ResponseDTO responseDTO = new ResponseDTO();
//        responseDTO.setSuccess(true);
//        responseDTO.setData(ShipmentOrderList);
//        return responseDTO;
//    }
//
//    /**
//     * 查询扫码出货的数据 ：
//     *      分次查询，避免数据过大而出现错误
//     * @param ShipmentOrderList 用于接收返回数据
//     * @param params 查询相关参数
//     * @throws CustomException
//     */
//    private void addShipmentOrderList(List<Map<String, Object>> ShipmentOrderList,Map<String,String> params) throws CustomException {
//        Integer page = 1;
//        Integer pageSize = 9000;
//        params.put("pageSize", pageSize.toString());
//        while (true) {
//            params.put("page", page.toString());
//            List<Map<String, Object>> resultData = shopService.getShipmentOrderByTime(params);
//            ShipmentOrderList.addAll(resultData);
//            if (resultData == null || resultData.size() < pageSize) {
//                break;
//            }
//            page++;
//        }
//    }
//
//    /**
//     * 跳转到商品库存统计页面
//     *
//     * @param request
//     * @param response
//     * @return
//     */
//    @RequiresPermissions("STOCK:STATISTICS")
//    @RequestMapping("/stock")
//    public String stock(HttpServletRequest request, HttpServletResponse response) {
//        return "content/statistics/stock";
//    }
//
//    /**
//     * 跳转到商品库存统计页面
//     *
//     * @param request
//     * @param response
//     * @return
//     */
////    @RequiresPermissions("STOCK:STATISTICS")
//    @RequestMapping("/stocks")
//    public String stocks(HttpServletRequest request, HttpServletResponse response) {
//        return "content/statistics/stock_s";
//    }
//
//
//    /**
//     * 查询商品库存
//     *
//     * @return
//     */
//    @RequestMapping("/selectStock")
//    public
//    @ResponseBody
//    ResponseDTO selectStock(MapQueryModel params) throws Exception {
//
//        Subject subject = SecurityUtils.getSubject();
//        ActiveUser activeUser = (ActiveUser) subject.getPrincipal();
//        params.getStringMap().put("channelCode", activeUser.getChannelName());
//
//        String quXianName = params.getStringMap().get("quXianName");
//
//        params.getStringMap().put("empName", activeUser.getEmpName());
//
//        if (activeUser.getQuXianName() != null && !"".equals(activeUser.getQuXianName())) {
//            quXianName = activeUser.getQuXianName();
//        }
//
//        if (quXianName != null && !quXianName.equals("")) {
//            String channelId = sPLOrderService.getIdByChannleName(quXianName);
//            params.getStringMap().put("parentChannelId", channelId == null ? "-99999" : channelId);
//        }
//
//        String channelName = activeUser.getRealChannelName();
//        if (channelName != null && !"".equals(channelName)) {
//            params.getStringMap().put("channelName", channelName);
//        }
//
//        PageDTO<Map<String, Object>> ShipmentOrderList = shopService.selectStock(params.getStringMap());
//        ResponseDTO responseDTO = new ResponseDTO();
//        responseDTO.setSuccess(true);
//        responseDTO.setData(ShipmentOrderList);
//        return responseDTO;
//    }
//
//    /**
//     * 查询商品库存
//     *
//     * @return
//     */
//    @RequestMapping("/selectStocks")
//    public
//    @ResponseBody
//    ResponseDTO selectStocks(MapQueryModel params) throws Exception {
//
//        Subject subject = SecurityUtils.getSubject();
//        ActiveUser activeUser = (ActiveUser) subject.getPrincipal();
//        params.getStringMap().put("channelCode", activeUser.getChannelName());
//
//        String quXianName = params.getStringMap().get("quXianName");
//
//        params.getStringMap().put("empName", activeUser.getEmpName());
//
//        if (activeUser.getQuXianName() != null && !"".equals(activeUser.getQuXianName())) {
//            quXianName = activeUser.getQuXianName();
//        }
//
//        if (quXianName != null && !quXianName.equals("")) {
//            String channelId = sPLOrderService.getIdByChannleName(quXianName);
//            params.getStringMap().put("parentChannelId", channelId == null ? "-99999" : channelId);
//        }
//
//        String channelName = activeUser.getRealChannelName();
//        if (channelName != null && !"".equals(channelName)) {
//            params.getStringMap().put("channelName", channelName);
//        }
//
//        PageDTO<Map<String, Object>> ShipmentOrderList = shopService.selectStocks(params.getStringMap());
//        System.out.println("ShipmentOrderList are ");
//        ResponseDTO responseDTO = new ResponseDTO();
//        responseDTO.setSuccess(true);
//        responseDTO.setData(ShipmentOrderList);
//        return responseDTO;
//    }
//
//    /**
//     * 获取店铺名称用来展示
//     *
//     * @return
//     */
//    @RequestMapping("/getShopNameToSelect")
//    public
//    @ResponseBody
//    ResponseDTO getShopNameToSelect(String channelName,String empName, String shopType) throws Exception {
//        Subject subject = SecurityUtils.getSubject();
//        ActiveUser activeUser = (ActiveUser) subject.getPrincipal();
//        Map<String, String> params = new HashMap<>(3);
//        params.put("channelName", activeUser.getChannelName());
//        params.put("userId", activeUser.getUserId());
//        params.put("shopType", shopType);
//
//        params.put("empName", empName);
//        if (StringUtils.isNot_NullOrTrimEmpty(activeUser.getEmpName())){
//            params.put("empName", activeUser.getEmpName());
//        }
//        params.put("quXianName", activeUser.getQuXianName());
//        params.put("pageChannelName", activeUser.getRealChannelName() != null && !"".equals(activeUser.getRealChannelName()) ? activeUser.getRealChannelName() : channelName);
//
//
//        List<Map<String, Object>> ShipmentOrderList = shopService.getShopNameToSelect(params);
//        ResponseDTO responseDTO = new ResponseDTO();
//        responseDTO.setSuccess(true);
//        responseDTO.setData(ShipmentOrderList);
//        return responseDTO;
//    }
//
//
//    /**
//     * 获取商品库存统计信息
//     *
//     * @param request
//     * @param response
//     * @return
//     */
//    @RequestMapping("/getStockStatistics")
//    public
//    @ResponseBody
//    ResponseDTO getStockStatistics(HttpServletRequest request, HttpServletResponse response) throws Exception {
//        String shopName = request.getParameter("shopName");
//        String stocks = request.getParameter("stocks");
//        Subject subject = SecurityUtils.getSubject();
//        ActiveUser activeUser = (ActiveUser) subject.getPrincipal();
//
//        Map<String, String> params = new HashMap<>();
//        params.put("stocks", stocks);
//
//        params.put("empName", activeUser.getEmpName());
//        params.put("realChannelName", activeUser.getRealChannelName());
//
//        String allChannleIds = sPLOrderService.getAllChannelIdByQuXianName(activeUser.getQuXianName());
//        params.put("allChannleIds", allChannleIds);
//        params.put("channelName", activeUser.getChannelName());
//        params.put("shopName", shopName);
//
//
//        Map<String, Object> ShipmentOrderList = shopService.getStockStatistics(params);
//
//        ResponseDTO responseDTO = new ResponseDTO();
//        responseDTO.setSuccess(true);
//        responseDTO.setData(ShipmentOrderList);
//        return responseDTO;
//    }
//
//    /**
//     * 统计数据导出到excel
//     *
//     * @param request
//     * @param response
//     * @throws Exception
//     */
//    @RequestMapping("/exportExcel")
//    public void exportExcel(HttpServletRequest request, HttpServletResponse response, MapQueryModel params) throws Exception {
//        logger.info("开始生成excel表格");
//        String exportExcelData = request.getParameter("exportExcelData");
//        String tableType = request.getParameter("tableType");
//        if (tableType == null) {
//            throw new CustomException("表格数据太大");
//        }
//
//        JSONArray jsonList = JSONArray.fromObject(exportExcelData);
//        List<Map<String, Object>> ShipmentOrderList = JSONArray.toList(jsonList, new HashMap<>(), new JsonConfig());
//        logger.info("json转List完毕");
//        Map<String, Object> map = new HashMap<>();
//        logger.info("tableType is : " + tableType);
//
//        String[] Keys = new String[0];
//        String[] columnNames = new String[0];
//
//        String fileName = "";
//
//        // 对用户角色权限进行分析处理
//        Subject subject = SecurityUtils.getSubject();
//        ActiveUser activeUser = (ActiveUser) subject.getPrincipal();
//        params.getStringMap().put("channelCode", activeUser.getChannelName());
//
//        String quXianName = params.getStringMap().get("quXianName");
//
//        if (StringUtils.isNot_NullOrTrimEmpty(activeUser.getEmpName())){
//            params.getStringMap().put("empName", activeUser.getEmpName());
//        }
//
//        if (!StringUtils.isNullOrTrimEmpty(activeUser.getQuXianName())) {
//            quXianName = activeUser.getQuXianName();
//        }
//
//        if (!StringUtils.isNullOrTrimEmpty(quXianName)) {
//            String channelId = sPLOrderService.getIdByChannleName(quXianName);
//            params.getStringMap().put("parentChannelId", channelId == null ? "-99999" : channelId);
//        }
//
//        String channelName = activeUser.getRealChannelName();
//        if (!StringUtils.isNullOrTrimEmpty(channelName)) {
//            params.getStringMap().put("channelName", channelName);
//        }
//        //根据导出类型获取导出数据
//        switch (tableType) {
//            case "stock": //商品库存
//                ShipmentOrderList.clear();
//                map.put("sheetName", "商品库存统计");
//                Keys = new String[]{"channelName", "shopName", "custName", "productName", "prodType", "barCode", "unit", "stock", "totalPrice"};
//                columnNames = new String[]{"渠道名称", "店铺名称", "客户名称", "商品名称", "商品类型", "商品条码", "商品单位", "库存数量", "库存金额"};
//                fileName = "商品库存统计";
//
//                //获取导出数据
//                Integer page = 1;
//                Integer pageSize = 6000;
//                params.getStringMap().put("pageSize", pageSize.toString());
//                while (true) {
//                    params.getStringMap().put("page", page.toString());
//                    List<Map<String, Object>> resultData = shopService.selectStockToExcel(params.getStringMap());
//                    ShipmentOrderList.addAll(resultData);
//                    if (resultData == null || resultData.size() < pageSize) {
//                        break;
//                    }
//                    page++;
//                }
//                break;
//            case "splOrder": //烟草订单
//                map.put("sheetName", "烟草订单统计");
//                Keys = new String[]{"id", "channelName", "slsmanName", "custName", "custCode", "orderTypeStr", "payStatusStr", "orderQtySum", "orderAmtSum", "modifiTimeStr"};
//                columnNames = new String[]{"订单编号", "机构名称", "客户经理", "客户名称", "专卖证号", "类型", "支付状态", "数量", "金额", "操作时间"};
//                fileName = "烟草订单统计";
//                break;
//
//            case "shipmentOrder": //扫码出货
//                ShipmentOrderList.clear();
//                map.put("sheetName", "扫码出货统计");
//                Keys = new String[]{"shopName", "prodName", "quantity", "benefitPrice", "amt",   "sales", "stock", "price", "username",  "customerPhone","operatorTime"};//"mobile","id", "channelName","totalPrice",
//                columnNames = new String[]{"店铺名称",  "商品名称", "出库数量","优惠价格", "实际支付",  "累计销量", "剩余库存", "商品单价", "操作人", "消费者电话","操作时间"};// "电话号码","订单编号", "渠道名称", "订单总价",
//                fileName = "扫码出货统计";
//
//                //获取导出数据
//                addShipmentOrderList(ShipmentOrderList, params.getStringMap());
//
//                break;
//            case "scratch": //物料投放
//                map.put("sheetName", "物料投放中奖统计");
//                Keys = new String[]{"prize", "timeStr", "phone", "shopName", "residue", "productName","source"};
//                columnNames = new String[]{"中奖奖品", "中奖时间", "中奖电话", "中奖店铺", "剩余奖品", "购买商品", "物料来源"};
//                fileName = "物料投放中奖统计";
//                break;
//            default:
//                break;
//        }
//        logger.info("添加sheetName的Map");
//        ShipmentOrderList.add(0, map);
//        logger.info("开始执行ExcelUtil.createHSSFWorkbook方法");
//        HSSFWorkbook wb;
//        try {
//            wb = ExcelUtil.createHSSFWorkbook2(ShipmentOrderList, Keys, columnNames);
//        }catch (IllegalArgumentException e) {
//            e.printStackTrace();
//            throw new CustomException("数据实在太大，建议分多次导出");
//        }
//
//        logger.info("执行ExcelUtil.createHSSFWorkbook方法完毕");
//        OutputStream out = response.getOutputStream();
//        response.reset();
//        response.setHeader("Content-Disposition", "attachment;filename=" + new String((fileName + ".xls").getBytes(), "iso-8859-1"));
//        response.setContentType("application/msexcel;charset=UTF-8");
//        logger.info("设置响应信息完成");
//        //输出excel文件
//        wb.write(out);
//        out.close();
//        logger.info("结束生成excel表格");
//    }
//
//
//    /**
//     * 统计数据导出到excel
//     *
//     * @param request
//     * @param response
//     * @throws Exception
//     */
//    @RequestMapping("/exportExcels")
//    public void exportExcels(HttpServletRequest request, HttpServletResponse response, MapQueryModel params) throws Exception {
//        logger.info("开始生成excel表格");
//        String exportExcelData = request.getParameter("exportExcelData");
//        String shopName = request.getParameter("shopName");
//        String shopType = request.getParameter("shopType");
//        String productTypeId = request.getParameter("productTypeId");
//        String tableType = request.getParameter("tableType");
//
//        if (tableType == null) {
//            throw new CustomException("表格数据太大");
//        }
//        logger.info("exportExcelData is "+exportExcelData);
//        JSONArray jsonList = JSONArray.fromObject(exportExcelData);
//        List<Map<String, Object>> ShipmentOrderList = JSONArray.toList(jsonList, new HashMap<>(), new JsonConfig());
//        logger.info("json转List完毕");
//        Map<String, Object> map = new HashMap<>();
//        logger.info("tableType is : " + tableType);
//
//        String[] Keys = new String[0];
//        String[] columnNames = new String[0];
//
//        String fileName = "";
//
//        // 对用户角色权限进行分析处理
//        Subject subject = SecurityUtils.getSubject();
//        ActiveUser activeUser = (ActiveUser) subject.getPrincipal();
//        params.getStringMap().put("channelCode", activeUser.getChannelName());
//
//        String quXianName = params.getStringMap().get("quXianName");
//
//        if (StringUtils.isNot_NullOrTrimEmpty(activeUser.getEmpName())){
//            params.getStringMap().put("empName", activeUser.getEmpName());
//        }
//
//        if (!StringUtils.isNullOrTrimEmpty(activeUser.getQuXianName())) {
//            quXianName = activeUser.getQuXianName();
//        }
//
//        if (!StringUtils.isNullOrTrimEmpty(quXianName)) {
//            String channelId = sPLOrderService.getIdByChannleName(quXianName);
//            params.getStringMap().put("parentChannelId", channelId == null ? "-99999" : channelId);
//        }
//
//        String channelName = activeUser.getRealChannelName();
//        if (!StringUtils.isNullOrTrimEmpty(channelName)) {
//            params.getStringMap().put("channelName", channelName);
//        }
//        //根据导出类型获取导出数据
//        switch (tableType) {
//
//            case "stock": //商品库存
//                ShipmentOrderList.clear();
//                map.put("sheetName", "商品库存统计");
//                Keys = new String[]{"shopName", "typeName","productName", "barCode", "unit", "stock"};
//                columnNames = new String[]{"店铺名称", "类型名称", "商品名称", "商品条码", "商品单位", "库存数量",};
//                fileName = "商品库存统计";
//
//                //获取导出数据
//                Integer page = 1;
//                Integer pageSize = 6000;
//                params.getStringMap().put("shopName", shopName);
//                params.getStringMap().put("shopType", shopType);
//                params.getStringMap().put("productTypeId", productTypeId);
//                params.getStringMap().put("pageSize", pageSize.toString());
//                while (true) {
//                    params.getStringMap().put("page", page.toString());
//                    PageDTO<Map<String, Object>> dto = shopService.selectStocks(params.getStringMap());
//                    System.out.println("params is " + params);
//                    List<Map<String, Object>> resultData = dto.getRecordList();
//                    ShipmentOrderList.addAll(resultData);
//                    if (resultData == null || resultData.size() < pageSize) {
//                        break;
//                    }
//                    page++;
//                }
//                break;
//        }
//        logger.info("添加sheetName的Map");
//        ShipmentOrderList.add(0, map);
//        logger.info("开始执行ExcelUtil.createHSSFWorkbook方法");
//        HSSFWorkbook wb;
//        try {
//            wb = ExcelUtil.createHSSFWorkbook2(ShipmentOrderList, Keys, columnNames);
//        }catch (IllegalArgumentException e) {
//            e.printStackTrace();
//            throw new CustomException("数据实在太大，建议分多次导出");
//        }
//
//        logger.info("执行ExcelUtil.createHSSFWorkbook方法完毕");
//        OutputStream out = response.getOutputStream();
//        response.reset();
//        response.setHeader("Content-Disposition", "attachment;filename=" + new String((fileName + ".xls").getBytes(), "iso-8859-1"));
//        response.setContentType("application/msexcel;charset=UTF-8");
//        logger.info("设置响应信息完成");
//        //输出excel文件
//        wb.write(out);
//        out.close();
//        logger.info("结束生成excel表格");
//    }
//
//    /**
//     * 获取商品属性树 -- 用于相关页面的查询条件
//     *
//     * @return
//     */
//    @RequestMapping("/getProductThreeName")
//    public
//    @ResponseBody
//    ResponseDTO getProductThreeName() throws Exception {
//        ResponseDTO responseDTO = new ResponseDTO();
//        responseDTO.setData(shopService.getProductThreeName());
//        responseDTO.setSuccess(true);
//        responseDTO.setMessage("获取成功");
//        responseDTO.setCode(HttpRequestConstant.REQUEST_SUCCESS_CODE);
//        return responseDTO;
//    }
//    /**
//     * 获取消费者详细信息
//     *
//     * @return
//     */
//    @RequestMapping("/getCustomerInfoByIdAndType")
//    public
//    @ResponseBody
//    ResponseDTO getCustomerInfoByIdAndType(String customerId,String shopId, String type) throws Exception {
//        ResponseDTO responseDTO = new ResponseDTO();
//        responseDTO.setData(shopService.getCustomerInfoByIdAndType(customerId,shopId,type));
//        responseDTO.setSuccess(true);
//        responseDTO.setMessage("获取成功");
//        responseDTO.setCode(HttpRequestConstant.REQUEST_SUCCESS_CODE);
//        return responseDTO;
//    }
//
//    /**
//     * 客户经理批量授权和绑卡 -- 上传excel
//     *
//     * @return
//     */
//    @RequestMapping("/uploadExcel")
//    public
//    @ResponseBody
//    ResponseDTO uploadExcel(MultipartFile excel) throws Exception {
//        ResponseDTO responseDTO = new ResponseDTO();
//        //原来的名字
//        String originalFileName = excel.getOriginalFilename();
//        //上传文件
//        if (excel != null && originalFileName != null && originalFileName.length() > 0) {
//            String excelFilePath = "/home/platformUploadExcel/";
//            Subject subject = SecurityUtils.getSubject();
//            //身份
//            ActiveUser activeUser = (ActiveUser) subject.getPrincipal();
//            //新的文件名称
//            SimpleDateFormat df = new SimpleDateFormat("yyyyMMddHHmmssSSS");//设置日期格式
//            String newFileName = activeUser.getUsername() + "-" + df.format(new Date()) + originalFileName.substring(originalFileName.lastIndexOf("."));
//
//            File file = new File(excelFilePath + newFileName);
//            excel.transferTo(file);
//            //TODO 读取文件信息，然后写入到数据库
//            Thread.sleep(100);
//            List<List<Map<String, String>>> excelResult = ExcelUtil.readExcelWithTitle(excelFilePath + newFileName);
//            List<Map<String, String>> excelResult_0 = excelResult.get(0);
//            BindCarThread bindCarThread = new BindCarThread("bindCar", excelResult_0, newFileName);
//            bindCarThread.start();
//            try {
//
//                cgtCustService.sendCloudingMessage("15210384645", "客户经理" + activeUser.getUsername() + "上传了Excel文件，文件路径：服务器230下面：" + excelFilePath + newFileName);
//            } catch (Exception e) {
//                e.printStackTrace();
//                logger.error("上传excel，发送小云消息失败");
//            }
//
//            responseDTO.setSuccess(true);
//            responseDTO.setMessage("成功");
//            responseDTO.setData(newFileName);
//            responseDTO.setCode(HttpRequestConstant.REQUEST_SUCCESS_CODE);
//        }
//        return responseDTO;
//    }
//
//
//    /**
//     * 客户经理下载excel模版
//     *
//     * @param request
//     * @param response
//     * @throws Exception
//     */
//    @RequestMapping("/downLoadExcelTemplate")
//    public void downLoadExcelTemplate(HttpServletRequest request, HttpServletResponse response) throws Exception {
//        String path = request.getSession().getServletContext().getRealPath("/static/file");
//        String filename = "retailUserInfoExcel.xls";
//        File file = new File(path, filename);
//        FileInputStream fileInputStream = new FileInputStream(file);
//        OutputStream out = response.getOutputStream();
//        response.reset();
//        response.setHeader("Content-Disposition", "attachment;filename=" + new String(("零售户信息收集" + ".xls").getBytes(), "iso-8859-1"));
//        response.setContentType("application/force-download;charset=UTF-8");
//        //输出excel文件
//        out.write(FileUtil.readAsByteArray(fileInputStream));
//        fileInputStream.close();
//        out.close();
//    }
//
//
//    /**
//     * 客户经理获取上传结果excel
//     *
//     * @param request
//     * @param response
//     * @throws Exception
//     */
//    @RequestMapping("/getUploadExcelResult")
//    public void getUploadExcelResult(HttpServletRequest request, String resultFileName, HttpServletResponse response) throws Exception {
//        File file = new File("/home/platformUploadExcel/result/", resultFileName);
//        if (file.exists()) {
//            FileInputStream fileInputStream = new FileInputStream(file);
//            OutputStream out = response.getOutputStream();
//            response.reset();
//            response.setHeader("Content-Disposition", "attachment;filename=" + new String(resultFileName.getBytes(), "iso-8859-1"));
//            response.setContentType("application/force-download;charset=UTF-8");
//            //输出excel文件
//            out.write(FileUtil.readAsByteArray(fileInputStream));
//            fileInputStream.close();
//            out.close();
//        } else {
//            throw new CustomException("文件不存在或者正在处理");
//        }
//
//    }
//
//
//    /**
//     * 检查客户经理要获取的结果excel是否存在
//     *
//     * @param request
//     * @param response
//     * @throws Exception
//     */
//    @RequestMapping("/examineUploadExcelResultIsExists")
//    public @ResponseBody
//    ResponseDTO examineUploadExcelResultIsExists(HttpServletRequest request, String resultFileName, HttpServletResponse response) throws Exception {
//        File file = new File("/home/platformUploadExcel/result/", resultFileName);
//        ResponseDTO responseDTO = new ResponseDTO();
//        if (file.exists()) {
//            responseDTO.setSuccess(true);
//        }
//        return responseDTO;
//    }
//
//    /**
//     * 跳转到综合分析页面 -- 库存统计客户为度
//     *
//     * @param request
//     * @param response
//     * @return
//     */
//    @RequiresPermissions("STOCK:STATISTICS")
//    @RequestMapping("/custanalyze")
//    public String custanalyze(HttpServletRequest request, HttpServletResponse response) {
//        return "content/statistics/custanalyze";
//    }
//
//    /**
//     * 跳转到综合分析页面 -- 库存统计商品为度
//     *
//     * @param request
//     * @param response
//     * @return
//     */
//    @RequiresPermissions("STOCK:STATISTICS")
//    @RequestMapping("/productanalyze")
//    public String productanalyze(HttpServletRequest request, HttpServletResponse response) {
//
//        return "content/statistics/productanalyze";
//    }
//
//    /**
//     * 跳转到综合分析页面
//     *
//     * @param request
//     * @param response
//     * @return
//     */
//    @Deprecated
//    @RequiresPermissions("STOCK:STATISTICS")
//    @RequestMapping("/synthesis")
//    public String synthesis(HttpServletRequest request, HttpServletResponse response) {
//        return "content/statistics/synthesis";
//    }
//
//
//    /**
//     * 综合查询
//     *
//     * @return
//     */
//    @RequestMapping("/getSynthesisSelect")
//    public
//    @ResponseBody
//    ResponseDTO getSynthesisSelect(MapQueryModel params) throws Exception {
//
//        params.getStringMap().put("fiveChannelCode", CustomUtil.getChannelCodePreFive(params.getStringMap().get("cityName")));
//
//        managerStringMap(params.getStringMap());
//
//        System.out.println("======= params ====== "+params);
//
//        System.out.println("======= params.getStringMap() ====== "+params.getStringMap());
//
//        //七个数量统计叫做--numResult
//        Map<String, Map<String, String>> result = shopService.getSynthesisSelect(params.getStringMap());
//        ResponseDTO responseDTO = new ResponseDTO();
//        responseDTO.setSuccess(true);
//        responseDTO.setData(result);
//        return responseDTO;
//    }
//
//    /**
//     * 大屏幕的数据
//     *
//     * @return
//     */
//    @RequestMapping("/getBigScreenStatisticsData")
//    public
//    @ResponseBody
//    ResponseDTO getBigScreenStatisticsData(MapQueryModel params) throws Exception {
//
//        /*params.getStringMap().put("fiveChannelCode", CustomUtil.getChannelCodePreFive(params.getStringMap().get("cityName")));*/
//
//        Map<String, Map<String, String>> result = shopService.getBigScreenStatisticsData(params.getStringMap());
//        ResponseDTO responseDTO = new ResponseDTO();
//        responseDTO.setSuccess(true);
//        responseDTO.setData(result);
//        return responseDTO;
//    }
//
//    /**
//     * 烟草客户库存分析
//     *
//     * @return
//     */
//    @RequestMapping("/getStockAnalyze")
//    public
//    @ResponseBody
//    ResponseDTO getStockAnalyze(MapQueryModel params) throws Exception {
//
//        managerStringMap(params.getStringMap());
//
//        PageDTO<Map<String, String>> result = shopService.getStockAnalyzeByPageQuery(params.getStringMap());
//
//        ResponseDTO responseDTO = new ResponseDTO();
//        responseDTO.setSuccess(true);
//        responseDTO.setData(result);
//        return responseDTO;
//    }
//
//
//    /**
//     * 针对页面传递过来的相关信息进行处理
//     *      公共方法 ： 处理用户角色信息
//     *
//     * @param stringMap
//     * @throws CustomException
//     */
//    private void managerStringMap(Map<String, String> stringMap) throws CustomException {
//        Subject subject = SecurityUtils.getSubject();
//        ActiveUser activeUser = (ActiveUser) subject.getPrincipal();
//        //实际上是市级--安顺，毕节，六盘水
//        if (!StringUtils.isNullOrTrimEmpty(activeUser.getChannelName())) {
//            stringMap.put("fiveChannelCode", CustomUtil.getChannelCodePreFive(activeUser.getChannelName()));
//        }
//
//        //区县处理
//        if (!StringUtils.isNullOrTrimEmpty(activeUser.getQuXianName())) {
//            stringMap.put("quXianName", activeUser.getQuXianName());
//        }
//
//        //渠道处理
//        if (!StringUtils.isNullOrTrimEmpty(activeUser.getRealChannelName())) {
//            stringMap.put("channelName", activeUser.getRealChannelName());
//        }
//
//        //客户经理处理
//        if (!StringUtils.isNullOrTrimEmpty(activeUser.getEmpName())) {
//            stringMap.put("empName", activeUser.getEmpName());
//        }
//
//    }
//
//
//    /**
//     * 综合分析 -- 库存分析导出到excel
//     *
//     * @param response
//     * @throws Exception
//     */
//    @RequestMapping("/stockAnalyzeExportExcel")
//    public void stockAnalyzeExportExcel(HttpServletRequest request, HttpServletResponse response) throws Exception {
//        logger.info("开始生成excel表格");
//
//        String productCode = request.getParameter("productCode");
//        String beginOperatorTime = request.getParameter("beginOperatorTime");
//        String endOperatorTime = request.getParameter("endOperatorTime");
//        String quXianName = request.getParameter("quXianName");
//        String channelName = request.getParameter("channelName");
//        String empName = request.getParameter("empName");
//        String custName = request.getParameter("custName");
//        String isExp = request.getParameter("isExp");
//        String orderLevel = request.getParameter("orderLevel");
//        String baseTypeName = request.getParameter("baseTypeName");
//        String cityType = request.getParameter("cityType");
//        String priceType = request.getParameter("priceType");
//        String tableType = request.getParameter("tableType");
//        String orderByName = request.getParameter("orderByName");
//        String orderByType = request.getParameter("orderByType");
//
//
//        Map<String, String> stringMap = new HashMap<>(16);
//        stringMap.put("productCode", productCode);
//        stringMap.put("beginOperatorTime", beginOperatorTime);
//        stringMap.put("endOperatorTime", endOperatorTime);
//        stringMap.put("quXianName", quXianName);
//        stringMap.put("channelName", channelName);
//        stringMap.put("empName", empName);
//        stringMap.put("custName", custName);
//        stringMap.put("isExp", isExp);
//        stringMap.put("orderLevel", orderLevel);
//        stringMap.put("baseTypeName", baseTypeName);
//        stringMap.put("cityType", cityType);
//        stringMap.put("priceType", priceType);
//        stringMap.put("tableType", tableType);
//        stringMap.put("orderByName", orderByName);
//        stringMap.put("orderByType", orderByType);
//
//        Map<String, Object> map = new HashMap<>();
//        logger.info("tableType is : " + tableType);
//        String[] Keys = new String[0];
//        String[] columnNames = new String[0];
//        String fileName = "";
//        List<Map<String, Object>> dataList = shopService.getStockAnalyzeExportExcelData(stringMap);
//        switch (tableType) {
//            case "cust": //库存分析-用户纬度
//                map.put("sheetName", "库存分析-用户纬度");
//                Keys = new String[]{"CUST_CODE", "CUST_NAME", "LAST_INVENTORY", "PERIOD_ORDER_QUANTITY", "PERIOD_SCAN_QUANTITY", "CURRENT_INVENTORY"}; //,"STOCK_TO_SALES"
//                columnNames = new String[]{"客户编号", "客户名称", "上期库存", "期间订货量", "期间扫码销售量", "本期库存"}; //,"存销比"
//                fileName = "库存分析-用户纬度";
//                break;
//            case "product": //库存分析-商品纬度
//                map.put("sheetName", "库存分析-商品纬度");
//                Keys = new String[]{"CUST_NAME", "LAST_INVENTORY", "PERIOD_ORDER_QUANTITY", "PERIOD_SCAN_QUANTITY", "CURRENT_INVENTORY"};//,"STOCK_TO_SALES"
//                columnNames = new String[]{"商品名称", "上期库存", "期间订货量", "期间扫码销售量", "本期库存"};//,"存销比"
//                fileName = "库存分析-商品纬度";
//                break;
//            default:
//                break;
//        }
//        logger.info("添加sheetName的Map");
//        dataList.add(0, map);
//        logger.info("开始执行ExcelUtil.createHSSFWorkbook方法");
//        HSSFWorkbook wb = ExcelUtil.createHSSFWorkbook(dataList, Keys, columnNames);
//        logger.info("执行ExcelUtil.createHSSFWorkbook方法完毕");
//        OutputStream out = response.getOutputStream();
//        response.reset();
//        response.setHeader("Content-Disposition", "attachment;filename=" + new String((fileName + ".xls").getBytes(), "iso-8859-1"));
//        response.setContentType("application/msexcel;charset=UTF-8");
//        logger.info("设置响应信息完成");
//        //输出excel文件
//        wb.write(out);
//        out.close();
//        logger.info("结束生成excel表格");
//    }
//
//    /**
//     * 查询所有客户名称用来做查询
//     *
//     * @return
//     * @throws Exception
//     */
//    @RequestMapping("/selectCustNameToSelected")
//    public @ResponseBody
//    ResponseDTO selectCustNameToSelected(String empName) throws Exception {
//        Map<String, String> params = new HashMap<>(3);
//        params.put("empName", empName);
//        managerStringMap(params);
//
//        List<Map<String, Object>> result = shopService.selectCustNameToSelected(params);
//        ResponseDTO responseDTO = new ResponseDTO();
//        responseDTO.setData(result);
//        responseDTO.setSuccess(true);
//        responseDTO.setMessage("查询成功");
//        return responseDTO;
//    }
//
//    /**
//     * 根据时间查询大转盘数据
//     *
//     * @return
//     */
//    @RequestMapping("/getDaZhuanPanPrizeByPageQuery")
//    public
//    @ResponseBody
//    @RequiresPermissions("DAZHUANPAN_PRIZE:STATISTICS")
//    ResponseDTO getDaZhuanPanPrizeByPageQuery(MapQueryModel params) throws Exception {
//
//        managerStringMap(params.getStringMap());
//
//        List<Map<String, Object>> prizeList = new ArrayList<>();
//
//        addPrizeListList(prizeList, params.getStringMap());
//
//        ResponseDTO responseDTO = new ResponseDTO();
//        responseDTO.setSuccess(true);
//        responseDTO.setData(prizeList);
//        return responseDTO;
//    }
//
//
//    /**
//     * 跳转到大转盘数据页面
//     *
//     * @param request
//     * @param response
//     * @return
//     */
//    @RequiresPermissions("DAZHUANPAN_PRIZE:STATISTICS")
//    @RequestMapping("/daZhuanPanPrize")
//    public String daZhuanPanPrize(HttpServletRequest request, HttpServletResponse response) {
//        return "content/statistics/daZhuanPanPrize";
//    }
//
//    /**
//     * 查询大转盘数据
//     * @param prizeList
//     * @param params
//     * @throws CustomException
//     */
//    private void addPrizeListList(List<Map<String, Object>> prizeList, Map<String,String> params) throws CustomException {
//        Integer page = 1;
//        Integer pageSize = StringUtils.isNullOrTrimEmpty(params.get("pageSize")) ? 9000 : Integer.valueOf(params.get("pageSize"));
//        params.put("pageSize", pageSize.toString());
//        while (true) {
//            params.put("page", page.toString());
//            List<Map<String, Object>> resultData = shopService.getDaZhuanPanPrizeByPageQuery(params);
//            prizeList.addAll(resultData);
//            if (resultData == null || resultData.size() < pageSize || pageSize != 9000) {
//                break;
//            }
//            page++;
//        }
//    }
//
//    /**
//     * 导出到excel -- 新的方法
//     *
//     * @param response
//     * @throws Exception
//     */
//    @RequestMapping("/exportExcel_new")
//    public void exportExcel_new(HttpServletRequest request, HttpServletResponse response,MapQueryModel params) throws Exception {
//        logger.info("开始生成excel表格");
//
//        managerStringMap(params.getStringMap());
//
//        List<Map<String, Object>> dataList = new ArrayList<>();
//
//
//        Map<String, Object> map = new HashMap<>();
//        String[] Keys = new String[0];
//        String[] columnNames = new String[0];
//        String fileName = "";
//        switch (request.getParameter("tableType")) {
//            case "daZhuanPan":
//                addPrizeListList(dataList, params.getStringMap());
//                map.put("sheetName", "大转盘中奖数据");
//                Keys = new String[]{"CHANNEL_NAME", "SLSMAN_NAME", "CUST_NAME", "CUST_CODE", "USER_NAME", "MOBILE", "PRIZE_NAME", "OPERATOR_TIME"};
//                columnNames = new String[]{"渠道名称", "客户经理", "客户名称", "专卖证号", "中奖用户", "中奖电话", "奖品", "操作时间"};
//                fileName = "大转盘中奖数据";
//                break;
//            case "product":
//                map.put("sheetName", "库存分析-商品纬度");
//                Keys = new String[]{"CUST_NAME", "LAST_INVENTORY", "PERIOD_ORDER_QUANTITY", "PERIOD_SCAN_QUANTITY", "CURRENT_INVENTORY"};//,"STOCK_TO_SALES"
//                columnNames = new String[]{"商品名称", "上期库存", "期间订货量", "期间扫码销售量", "本期库存"};//,"存销比"
//                fileName = "库存分析-商品纬度";
//                break;
//            default:
//                break;
//        }
//        logger.info("添加sheetName的Map");
//        dataList.add(0, map);
//        logger.info("开始执行ExcelUtil.createHSSFWorkbook方法");
//        HSSFWorkbook wb = ExcelUtil.createHSSFWorkbook2(dataList, Keys, columnNames);
//        logger.info("执行ExcelUtil.createHSSFWorkbook方法完毕");
//        OutputStream out = response.getOutputStream();
//        response.reset();
//        response.setHeader("Content-Disposition", "attachment;filename=" + new String((fileName + ".xls").getBytes(), "iso-8859-1"));
//        response.setContentType("application/msexcel;charset=UTF-8");
//        logger.info("设置响应信息完成");
//        //输出excel文件
//        wb.write(out);
//        out.close();
//        logger.info("结束生成excel表格");
//    }
//
//
//    /**
//     * 重写扫码出货统计数图
//     * @param params
//     * @return
//     * @throws CustomException
//     */
//    @RequestMapping("/getShipmentOrderOX")
//    public
//    @ResponseBody
//    ResponseDTO getShipmentOrderOX(MapQueryModel params) throws CustomException {
//
//        ResponseDTO responseDTO = new ResponseDTO();
//        Map<String, Object> result = new HashMap<>(4);
//
//        List<Map<String, Object>> ShipmentOrderList = null;
//        Map<String, Object> ShipmentOrderDayData = null;//按天查询的订单统计数据
//        Map<String, Object> ShipmentOrderMonthData = null;//按天查询的订单统计数据
//        Map<String, Object> ShipmentOrderYearData = null;//按天查询的订单统计数据
//        try {
//            ShipmentOrderList = shopService.findShipmentOrderByLsatCreateTime(params.getStringMap());
//            if (ShipmentOrderList != null && !ShipmentOrderList.isEmpty()) {
//                ShipmentOrderDayData = shopService.findShipmentOrderDayData(params.getStringMap());
//                ShipmentOrderMonthData = shopService.findShipmentOrderMonthData(params.getStringMap());
//                ShipmentOrderYearData = shopService.findShipmentOrderYearData(params.getStringMap());
//            }
//            responseDTO.setSuccess(true);
//            responseDTO.setMessage("获取成功");
//            responseDTO.setCode(HttpRequestConstant.REQUEST_SUCCESS_CODE);
//        } catch (CustomException e) {
//            e.printStackTrace();
//            responseDTO.setMessage(e.getMessage());
//        } catch (Exception ex) {
//            ex.printStackTrace();
//            responseDTO.setMessage("未知错误");
//        }
//        result.put("ShipmentOrderList", ShipmentOrderList);
//        result.put("ShipmentOrderDayData", ShipmentOrderDayData);
//        result.put("ShipmentOrderMonthData", ShipmentOrderMonthData);
//        result.put("ShipmentOrderYearData", ShipmentOrderYearData);
//        responseDTO.setData(result);
//        return responseDTO;
//    }
//
//
//
//
//    @RequestMapping("/getBigScreenData")
//    public  @ResponseBody
//    ResponseDTO getBigScreenData(String centerCode)  throws CustomException {
//        ResponseDTO responseDTO = new ResponseDTO();
//        Map<String,Object> param = new HashMap<String,Object>();
//        param.put("centerCode",centerCode);
//        try{
//            List<Map<String, Object>> screenData = shopService.getBigScreenData(param);
//            responseDTO.setCode("200");
//            responseDTO.setMessage("获取成功");
//            responseDTO.setData(screenData);
//        }catch (Exception e){
//            responseDTO.setData("400");
//        }
//        return responseDTO;
//    }
//}